package org.example.controller;

import org.example.domain.model.Result;
import org.example.service.IDisableService;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/disable")
@CrossOrigin("*")
public class DisableController {

    private IDisableService iDisableService;

    public DisableController(IDisableService iDisableService) {
        this.iDisableService = iDisableService;
    }

    @RequestMapping
    public Result disableUser(Integer userStatus,Integer userId){
        int i = iDisableService.disableUser(userId, userStatus);
        if (userStatus==1){
            return Result.buildFail("启用成功");
        }else {
            return Result.buildFail("禁用成功");
        }

    }
}
